<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>C++ 笔记 | 麦甜怪圈 Xiaomai Circle</title><meta name="author" content="小麦 Andrew Xiaomai"><meta name="copyright" content="小麦 Andrew Xiaomai"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="C++笔记C++源程序打印Hello World 假设你已经装好了Mingw编译器，没有安装的话，请自行移步网络上找教程  第1步：为了方便教学，我们在桌面创建一个文件夹，名为cpp-tutor 第2步：在cpp-tutor文件夹里创建一个txt文件，文件名为hello，后缀名由txt改为cpp，将以下内容输入进文件内容 #include &lt;iostream&gt;using namespa">
<meta property="og:type" content="article">
<meta property="og:title" content="C++ 笔记">
<meta property="og:url" content="https://kingsmai.github.io/2021/10/09/%E7%AC%94%E8%AE%B0/index.html">
<meta property="og:site_name" content="麦甜怪圈 Xiaomai Circle">
<meta property="og:description" content="C++笔记C++源程序打印Hello World 假设你已经装好了Mingw编译器，没有安装的话，请自行移步网络上找教程  第1步：为了方便教学，我们在桌面创建一个文件夹，名为cpp-tutor 第2步：在cpp-tutor文件夹里创建一个txt文件，文件名为hello，后缀名由txt改为cpp，将以下内容输入进文件内容 #include &lt;iostream&gt;using namespa">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://wallpaper.dog/small/5558009.jpg">
<meta property="article:published_time" content="2021-10-09T05:24:48.000Z">
<meta property="article:modified_time" content="2023-12-17T23:28:00.309Z">
<meta property="article:author" content="小麦 Andrew Xiaomai">
<meta property="article:tag" content="Cpp 基础">
<meta property="article:tag" content="学习笔记">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://wallpaper.dog/small/5558009.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://kingsmai.github.io/2021/10/09/%E7%AC%94%E8%AE%B0/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"这篇文章已经","messageNext":"天未被更新了，可能里边的内容已经过时，请注意斟酌。"},
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 小麦 Andrew Xiaomai","link":"链接: ","source":"来源: 麦甜怪圈 Xiaomai Circle","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体中文","cht_to_chs":"你已切换为简体中文","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: true,
  percent: {
    toc: true,
    rightside: true,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'C++ 笔记',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-12-18 07:28:00'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><link rel="stylesheet" href="https://at.alicdn.com/t/c/font_4366094_hx3hbrje2st.css"><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/atom.xml" title="麦甜怪圈 Xiaomai Circle" type="application/atom+xml">
<link rel="alternate" href="/rss2.xml" title="麦甜怪圈 Xiaomai Circle" type="application/rss+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://avatars.githubusercontent.com/u/23566051?s=400&amp;u=cc8834557b9fe7ca3db3adc89606ae47503e603d&amp;v=4" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">54</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">37</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://wallpaper.dog/small/5558009.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="麦甜怪圈 Xiaomai Circle"><img class="site-icon" src="/img/logos/Logo-11.jpg"/><span class="site-name">麦甜怪圈 Xiaomai Circle</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">C++ 笔记</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-10-09T05:24:48.000Z" title="发表于 2021-10-09 13:24:48">2021-10-09</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-12-17T23:28:00.309Z" title="更新于 2023-12-18 07:28:00">2023-12-18</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/">编程语言</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/Cpp/">Cpp</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>8分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="C++ 笔记"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="C-笔记"><a href="#C-笔记" class="headerlink" title="C++笔记"></a>C++笔记</h1><h2 id="C-源程序打印Hello-World"><a href="#C-源程序打印Hello-World" class="headerlink" title="C++源程序打印Hello World"></a>C++源程序打印Hello World</h2><blockquote>
<p>假设你已经装好了Mingw编译器，没有安装的话，请自行移步网络上找教程</p>
</blockquote>
<p><strong>第1步：</strong>为了方便教学，我们在桌面创建一个文件夹，名为<code>cpp-tutor</code></p>
<p><strong>第2步：</strong>在<code>cpp-tutor</code>文件夹里创建一个txt文件，文件名为<code>hello</code>，后缀名由<code>txt</code>改为<code>cpp</code>，将以下内容输入进文件内容</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;Hello, world!&quot;</span> &lt;&lt; endl;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>第3步：</strong>使用<code>Win键 + R</code>打开运行窗口，输入<code>cmd</code>打开命令控制符</p>
<p><strong>第4步：</strong>在命令控制符里输入</p>
<figure class="highlight bat"><table><tr><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">%USERPROFILE%</span>/Desktop/cpp-tutor</span><br></pre></td></tr></table></figure>
<p>打开刚刚创建好的文件夹</p>
<blockquote>
<p>默认情况下，打开控制台的默认路径就已经是<code>C:\Users\用户名</code>了，这时候只需要输入<code>cd Desktop/cpp-tutor</code>即可</p>
</blockquote>
<p><strong>第5步：</strong>然后输入</p>
<figure class="highlight bat"><table><tr><td class="code"><pre><span class="line">g++ ./hello.cpp -o helloworld</span><br></pre></td></tr></table></figure>
<p>此程序用于编译刚才写好的<code>hello.cpp</code>C++源程序，并将其输出的可执行文件<code>.exe</code>命名为helloworld</p>
<p>接下来，如果没有出现报错（控制台没有出现任何东西，视为编译通过。也可以通过检查刚刚创建的文件夹里有没有<code>helloworld.exe</code>来判断是否编译成功）</p>
<blockquote>
<p>或者可以通过在控制台输入<code>dir</code>，输出文件列表查看列表中是否出现<code>helloworld.exe</code></p>
</blockquote>
<p><strong>第6步：</strong>然后输入</p>
<figure class="highlight bat"><table><tr><td class="code"><pre><span class="line">helloworld.exe</span><br></pre></td></tr></table></figure>
<p>执行刚才编译好的可执行文件。接下来你应该会在控制台上发现<code>Hello, world!</code>被打印输出了。</p>
<p>我们可以将<strong>第5步和第6步</strong>合并为一句：</p>
<figure class="highlight bat"><table><tr><td class="code"><pre><span class="line">g++ hello.cpp -o helloworld &amp;&amp; helloworld.exe</span><br></pre></td></tr></table></figure>
<p>用了<code>&amp;&amp;</code>号，意思是：当编译成功，则直接执行exe文件。</p>
<h3 id="代码解释"><a href="#代码解释" class="headerlink" title="代码解释"></a>代码解释</h3><figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span> <span class="comment">// &lt;iostream&gt; 头文件定义了标准数据输入输出流，使程序能够将文字输出到控制台上。</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std; <span class="comment">// std 命名空间包含C++标准库的而功能（cout、endl）</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 每个C系程序有且仅有一个main函数，是整个程序的入口。返回值必须是int类型，代表程序运行的异常代码。</span></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;Hello, world!&quot;</span> &lt;&lt; endl; <span class="comment">// C++的输出语句的语法，`endl`表示换行，可以用`\n`来代替`endl`。</span></span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>; <span class="comment">// 0表示此程序正常退出。</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这就是最简单的输出语句了。</p>
<h2 id="输出语句"><a href="#输出语句" class="headerlink" title="输出语句"></a>输出语句</h2><p>输出语句的其他用法：</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;其实可以分很多行来写&quot;</span></span><br><span class="line">        &lt;&lt; <span class="string">&quot;比如这一句包含很多句子，&quot;</span></span><br><span class="line">        &lt;&lt; <span class="string">&quot;这么写就能提高代码可读性&quot;</span> &lt;&lt; endl; <span class="comment">// 这一个将会被当作一句输出</span></span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;我们也可以通过\n&quot;</span></span><br><span class="line">        &lt;&lt; <span class="string">&quot;来实现换行\n&quot;</span>; <span class="comment">// 用 \n 取代endl，达成换行效果</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="变量"><a href="#变量" class="headerlink" title="变量"></a>变量</h2><figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="type">int</span> myVariable = <span class="number">10</span>; <span class="comment">// 声明一个整型变量myVariable，并赋值10给它</span></span><br><span class="line">    <span class="type">int</span> a = <span class="number">30</span>, b = <span class="number">15</span>; <span class="comment">// 同时声明两个整数型变量，并分别赋值30, 15给它们</span></span><br><span class="line">    <span class="type">int</span> sum = a + b; <span class="comment">// 将上面声明的a, b变量相加，并赋值给新声明的sum变量</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">// 我们可以通过cout输出每个变量的值</span></span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;myVariable = &quot;</span> &lt;&lt; myVariable &lt;&lt; endl;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;a = &quot;</span> &lt;&lt; a</span><br><span class="line">        &lt;&lt; <span class="string">&quot;, b = &quot;</span> &lt;&lt; b &lt;&lt; endl;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;sum = &quot;</span> &lt;&lt; sum &lt;&lt; endl;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="输入语句"><a href="#输入语句" class="headerlink" title="输入语句"></a>输入语句</h2><p>我们可以通过输入语句获取用户的输入</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="type">int</span> userInput; <span class="comment">// 声明变量，可以不赋值。</span></span><br><span class="line">    <span class="comment">// C++没有默认值，当下分配到的地址值原先是多少，就是它的默认值（MSVC）</span></span><br><span class="line">    </span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;请输入一个整数值：&quot;</span>; <span class="comment">// 输入提示</span></span><br><span class="line">    cin &gt;&gt; userInput; <span class="comment">// 获取用户输入（注意箭头朝右）</span></span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;所输入的值是：&quot;</span> &lt;&lt; userInput &lt;&lt; endl;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h2><figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="type">unsigned</span> <span class="type">long</span> <span class="type">int</span> x = <span class="number">100</span>;  <span class="comment">// unsigned 只能保存正数，long 占用默认两倍的字节</span></span><br><span class="line">    <span class="type">short</span> <span class="type">int</span> y = <span class="number">16</span>;           <span class="comment">// short 是只占用默认一半的字节</span></span><br><span class="line">    <span class="type">float</span> pi = <span class="number">3.14</span>;            <span class="comment">// float 占用4个字节</span></span><br><span class="line">    <span class="type">double</span> temp = <span class="number">36.8</span>;         <span class="comment">// double 占用8个字节</span></span><br><span class="line">    string txt = <span class="string">&quot;Hello world&quot;</span>; <span class="comment">// string 是一个字符串，是C++标准库里的。</span></span><br><span class="line">    <span class="type">char</span> ch = <span class="string">&#x27;A&#x27;</span>;              <span class="comment">// char 字符</span></span><br><span class="line">    <span class="type">bool</span> isLearning = <span class="literal">true</span>;     <span class="comment">// bool 只有两个值：true 和 false</span></span><br><span class="line">    <span class="type">bool</span> isPlaying = <span class="number">0</span>;         <span class="comment">// 也可以用数值0、1代替，将其输出，将会输出0和1，而不是true和false</span></span><br><span class="line">    cout &lt;&lt; isLearning &lt;&lt; endl;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="对char型的一些研究"><a href="#对char型的一些研究" class="headerlink" title="对char型的一些研究"></a>对char型的一些研究</h3><p>char型变量用于保存一个字符，如A，b等等。用一段程序来进行研究，研究目的是创建一个“令白嫖党看不懂的”版权信息</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;ctime&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="comment">// char 叫多字节字符，一个 char 占一个字节</span></span><br><span class="line">    <span class="type">char</span> ch = <span class="string">&#x27;A&#x27;</span>;</span><br><span class="line">    <span class="type">int</span> ascii_A = (<span class="type">int</span>)ch;                  <span class="comment">// 将字符转换成ASCII码</span></span><br><span class="line">    cout &lt;&lt; ch &lt;&lt; <span class="string">&quot; : &quot;</span> &lt;&lt; ascii_A &lt;&lt; endl; <span class="comment">// A : 65</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 每一个英文字符都能转换成对应的ASCII（美国信息交换标准代码）</span></span><br><span class="line">    <span class="comment">// 所以：</span></span><br><span class="line">    <span class="type">char</span> copyright[] = <span class="string">&quot;Made by Xiaomai&quot;</span>; <span class="comment">// 这是版权信息</span></span><br><span class="line">    cout &lt;&lt; copyright &lt;&lt; endl;            <span class="comment">// Made by Xiaomai</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 找到它的长度</span></span><br><span class="line">    <span class="type">int</span> len = <span class="built_in">sizeof</span>(copyright) / <span class="built_in">sizeof</span>(copyright[<span class="number">0</span>]);</span><br><span class="line">    cout &lt;&lt; len &lt;&lt; endl; <span class="comment">// 16（包括结束标识符\0）</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 遍历转换成ASCII码</span></span><br><span class="line">    <span class="type">int</span> i, temp;</span><br><span class="line">    <span class="keyword">for</span> (i = <span class="number">0</span>; i &lt; len; i++) &#123;</span><br><span class="line">        temp = (<span class="type">int</span>)copyright[i];</span><br><span class="line">        cout &lt;&lt; temp &lt;&lt; <span class="string">&quot;, &quot;</span>; <span class="comment">// 将每一个字符的ASCII码输出出来</span></span><br><span class="line">    &#125;</span><br><span class="line">    cout &lt;&lt; endl; <span class="comment">// 换行</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 到这里先运行一遍，获取每个字符的ASCII码</span></span><br><span class="line">    <span class="comment">// 复制控制台中的这一段：77, 97, 100, 101, 32, 98, 121, 32, 88, 105, 97, 111, 109, 97, 105, 0</span></span><br><span class="line">    <span class="comment">// 最后一个逗号不需要</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 创建新的字符数组，数组元素为上面的这一串ASCII码</span></span><br><span class="line">    <span class="type">char</span> a[] = &#123;<span class="number">77</span>, <span class="number">97</span>, <span class="number">100</span>, <span class="number">101</span>, <span class="number">32</span>, <span class="number">98</span>, <span class="number">121</span>, <span class="number">32</span>, <span class="number">88</span>, <span class="number">105</span>, <span class="number">97</span>, <span class="number">111</span>, <span class="number">109</span>, <span class="number">97</span>, <span class="number">105</span>, <span class="number">0</span>&#125;;</span><br><span class="line">    cout &lt;&lt; a &lt;&lt; endl; <span class="comment">// Made by Xiaomai</span></span><br><span class="line">    <span class="comment">// 就可以得到一个记录版权信息的字符串了。</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">// 接下来是让这组信息在特定时间点之后才出现</span></span><br><span class="line">    <span class="comment">// 注意：time函数需要引用头文件&lt;ctime&gt;</span></span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">time</span>(<span class="number">0</span>) &gt; <span class="number">1621094400</span>) &#123;</span><br><span class="line">        <span class="comment">// 2021年5月16日之后才会显示</span></span><br><span class="line">        <span class="comment">// 至于UNIX时间戳，自行谷歌计算</span></span><br><span class="line">        cout &lt;&lt; a &lt;&lt; endl;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>把过程简化，最后我们只需要这么几行：</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;ctime&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="type">char</span> a[] = &#123;<span class="number">77</span>, <span class="number">97</span>, <span class="number">100</span>, <span class="number">101</span>, <span class="number">32</span>, <span class="number">98</span>, <span class="number">121</span>, <span class="number">32</span>, <span class="number">88</span>, <span class="number">105</span>, <span class="number">97</span>, <span class="number">111</span>, <span class="number">109</span>, <span class="number">97</span>, <span class="number">105</span>, <span class="number">0</span>&#125;;</span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">time</span>(<span class="number">0</span>) &gt; <span class="number">1621094400</span>) &#123;</span><br><span class="line">        cout &lt;&lt; a &lt;&lt; endl;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这个嘛，你把它藏在你的程序中间，可以防止有人白嫖你的作业去交。比较适合坑新手~</p>
<h4 id="汉字引发的惨案"><a href="#汉字引发的惨案" class="headerlink" title="汉字引发的惨案"></a>汉字引发的惨案</h4><p>不说了，看半成品……毫无头绪</p>
<figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="type">char</span> str[<span class="number">4</span>] = <span class="string">&quot;我&quot;</span>;  <span class="comment">//前三个字节存放汉字&#x27;我&#x27;,最后一个字节存放字符串结束符\0</span></span><br><span class="line">    cout &lt;&lt; str &lt;&lt; endl; <span class="comment">// 我</span></span><br><span class="line">    </span><br><span class="line">    <span class="type">char</span> ni = <span class="string">&#x27;你&#x27;</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// wchar_t 被称为宽字符，一个 wchar_t 占 2 个字节。</span></span><br><span class="line">    <span class="type">wchar_t</span> hans = <span class="string">L&#x27;我&#x27;</span>; <span class="comment">// 等价于 L&#x27;\x6211&#x27;</span></span><br><span class="line">    <span class="type">int</span> ascii_hans = (<span class="type">int</span>)hans;</span><br><span class="line">    cout &lt;&lt; hans &lt;&lt; <span class="string">&quot; : &quot;</span> &lt;&lt; ascii_hans &lt;&lt; endl; <span class="comment">// 我 :</span></span><br><span class="line"></span><br><span class="line">    <span class="type">wchar_t</span> wstr[<span class="number">2</span>] = <span class="string">L&quot;中&quot;</span>; <span class="comment">// 前两个字节(前一个 wchar_t)存放汉字&#x27;中&#x27;,最后两个字节(后一个 wchar_t)存放字符串结束符\0</span></span><br><span class="line">    <span class="type">wchar_t</span> wstr2[<span class="number">3</span>] = <span class="string">L&quot;中国&quot;</span>;</span><br><span class="line">    cout &lt;&lt; wstr &lt;&lt; endl; <span class="comment">// 这里会输出地址，我还要研究怎么输出文字</span></span><br><span class="line">    cout &lt;&lt; wstr2 &lt;&lt; endl;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="数组"><a href="#数组" class="headerlink" title="数组"></a>数组</h2><figure class="highlight c++"><table><tr><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;iostream&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="type">int</span> a[<span class="number">5</span>] = &#123;<span class="number">11</span>, <span class="number">45</span>, <span class="number">62</span>, <span class="number">70</span>, <span class="number">88</span>&#125;; <span class="comment">// 声明一个长度为5的数组，然后赋值</span></span><br><span class="line">    cout &lt;&lt; a &lt;&lt; endl; <span class="comment">// 打印的是地址值</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">// 数组下标从0开始，所以要打印第n个元素时，下标需为n-1：</span></span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;第2个元素为：&quot;</span> &lt;&lt; a[<span class="number">1</span>] &lt;&lt; endl;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://kingsmai.github.io">小麦 Andrew Xiaomai</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://kingsmai.github.io/2021/10/09/%E7%AC%94%E8%AE%B0/">https://kingsmai.github.io/2021/10/09/笔记/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://kingsmai.github.io" target="_blank">麦甜怪圈 Xiaomai Circle</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Cpp-%E5%9F%BA%E7%A1%80/">Cpp 基础</a><a class="post-meta__tags" href="/tags/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">学习笔记</a></div><div class="post_share"><div class="social-share" data-image="https://wallpaper.dog/small/5558009.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i>欢迎打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wallets/WechatPaySquare.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wallets/WechatPaySquare.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/wallets/AlipaySquare.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wallets/AlipaySquare.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2021/08/17/RPG-%E6%B8%B8%E6%88%8F%E5%BC%80%E5%8F%91%EF%BC%8819%EF%BC%89%E5%87%86%E5%A4%87%E6%AD%A6%E5%99%A8/" title="RPG 游戏开发（19）准备武器"><img class="cover" src="/img/covers/Unity2020rpg2d.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">RPG 游戏开发（19）准备武器</div></div></a></div><div class="next-post pull-right"><a href="/2021/10/09/%E7%AC%AC%201%20%E8%AF%BE/" title="Python 第一课"><img class="cover" src="https://wallpaper.dog/small/5558009.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Python 第一课</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://avatars.githubusercontent.com/u/23566051?s=400&amp;u=cc8834557b9fe7ca3db3adc89606ae47503e603d&amp;v=4" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">小麦 Andrew Xiaomai</div><div class="author-info__description">一个喜欢肉鸽类游戏的程序员<br>分享日常生活，学习笔记，技术文章等。感兴趣想一起开发游戏的欢迎联系我哟！</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">54</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">37</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><a id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/kingsmai"><i class="fab fa-github"></i><span>关注我</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/kingsmai" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="iconfont icon-GitHub" style="color: #24292e;"></i></a><a class="social-icon" href="https://space.bilibili.com/670118055" rel="external nofollow noreferrer" target="_blank" title="BiliBili"><i class="iconfont icon-bilibili-fill" style="color: #ff6699;"></i></a><a class="social-icon" href="mailto:xsbugh@gmail.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="iconfont icon-email-fill" style="color: #ff3e30;"></i></a><a class="social-icon" href="https://www.zhihu.com/people/creeper0924" rel="external nofollow noreferrer" target="_blank" title="Zhihu"><i class="iconfont icon-zhihu" style="color: #1772F6;"></i></a><a class="social-icon" href="https://blog.csdn.net/Xsbugh" rel="external nofollow noreferrer" target="_blank" title="CSDN"><i class="iconfont icon-csdn" style="color: #FC4144;"></i></a><a class="social-icon" href="https://www.linkedin.com/in/%E5%B0%8F%E9%BA%A6-xiaomai-0a672124b/" rel="external nofollow noreferrer" target="_blank" title="LinkedIn"><i class="iconfont icon-linkedin" style="color: #0A66C2;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="RSS 链接"><i class="iconfont icon-Atom" style="color: #6EA3E5;"></i></a><a class="social-icon" href="/rss2.xml" target="_blank" title="RSS 链接"><i class="iconfont icon-dingyue" style="color: #ee802f;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="card-widget"><div class="item-headline"><i></i><span></span></div><div class="item-content"></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#C-%E7%AC%94%E8%AE%B0"><span class="toc-number">1.</span> <span class="toc-text">C++笔记</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#C-%E6%BA%90%E7%A8%8B%E5%BA%8F%E6%89%93%E5%8D%B0Hello-World"><span class="toc-number">1.1.</span> <span class="toc-text">C++源程序打印Hello World</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81%E8%A7%A3%E9%87%8A"><span class="toc-number">1.1.1.</span> <span class="toc-text">代码解释</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BE%93%E5%87%BA%E8%AF%AD%E5%8F%A5"><span class="toc-number">1.2.</span> <span class="toc-text">输出语句</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%98%E9%87%8F"><span class="toc-number">1.3.</span> <span class="toc-text">变量</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BE%93%E5%85%A5%E8%AF%AD%E5%8F%A5"><span class="toc-number">1.4.</span> <span class="toc-text">输入语句</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="toc-number">1.5.</span> <span class="toc-text">数据类型</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AF%B9char%E5%9E%8B%E7%9A%84%E4%B8%80%E4%BA%9B%E7%A0%94%E7%A9%B6"><span class="toc-number">1.5.1.</span> <span class="toc-text">对char型的一些研究</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B1%89%E5%AD%97%E5%BC%95%E5%8F%91%E7%9A%84%E6%83%A8%E6%A1%88"><span class="toc-number">1.5.1.1.</span> <span class="toc-text">汉字引发的惨案</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%B0%E7%BB%84"><span class="toc-number">1.6.</span> <span class="toc-text">数组</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/12/20/ML-8-%E6%9E%84%E5%BB%BA%E9%80%BB%E8%BE%91%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（8）构建逻辑回归模型"><img src="/img/covers/sklearn-build-linear-regression-model.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（8）构建逻辑回归模型"/></a><div class="content"><a class="title" href="/2023/12/20/ML-8-%E6%9E%84%E5%BB%BA%E9%80%BB%E8%BE%91%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（8）构建逻辑回归模型">Sololearn 自学机器学习（8）构建逻辑回归模型</a><time datetime="2023-12-19T16:15:57.000Z" title="发表于 2023-12-20 00:15:57">2023-12-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型"><img src="/img/covers/linear-regression-3.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（7）线性回归模型"/></a><div class="content"><a class="title" href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型">Sololearn 自学机器学习（7）线性回归模型</a><time datetime="2023-12-19T08:07:36.000Z" title="发表于 2023-12-19 16:07:36">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/" title="Sololearn 自学机器学习（6）分类 Classification"><img src="/img/covers/classifications-3.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（6）分类 Classification"/></a><div class="content"><a class="title" href="/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/" title="Sololearn 自学机器学习（6）分类 Classification">Sololearn 自学机器学习（6）分类 Classification</a><time datetime="2023-12-19T05:36:19.000Z" title="发表于 2023-12-19 13:36:19">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础"><img src="/img/covers/matplotlib-plot-basic-5.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（5）Matplotlib 绘图基础"/></a><div class="content"><a class="title" href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础">Sololearn 自学机器学习（5）Matplotlib 绘图基础</a><time datetime="2023-12-18T17:08:34.000Z" title="发表于 2023-12-19 01:08:34">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/18/ML-4-Numpy-%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（4）Numpy 数据处理"><img src="/img/covers/numpy-data-processing-2.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（4）Numpy 数据处理"/></a><div class="content"><a class="title" href="/2023/12/18/ML-4-Numpy-%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（4）Numpy 数据处理">Sololearn 自学机器学习（4）Numpy 数据处理</a><time datetime="2023-12-18T13:26:11.000Z" title="发表于 2023-12-18 21:26:11">2023-12-18</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://wallpaper.dog/small/5558009.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2023 By 小麦 Andrew Xiaomai</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://icp.gov.moe/?keyword=20235160" rel="external nofollow noreferrer" target="_blank"><img class="icp-icon" src="/img/moe-icons/icon120.png">备案号：✮萌ICP备20235160号✮</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"></div><canvas class="fireworks" mobile="true"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div></body></html>